#include "type.h"
#include "const.h"
#include "protect.h"
#include "string.h"
#include "proc.h"
#include "tty.h"
#include "console.h"
#include "global.h"
#include "keyboard.h"
#include "proto.h"


/*================================================

*================================================*/
PUBLIC void spin(char* func_name)
{
    printl("\nspinning in %s ...\n", func_name);
    while(1){}
}

/*====================================================
 invoked by assert().
 @param exp
*====================================================*/
PUBLIC  void assertion_failure(char* exp, char* file, char* base_file, int line)
{
    printl("%c assert(%s) failed: file: %s, base_file: %s, ln%d",
           MAG_CH_ASSERT,
           exp, file, base_file, line);

    /*
    If assertion fails in a TASK, the system will halt before printl() returns.
    If it happens in a USER PROC, printl() will return like a common routine and arrive here.
    see sys_printx().
    We use a forever loop to prevent the proc from going on:
    */
    spin("assertion_failure()");

    // should never arrive here
    __asm__ __volatile__("ud2");
}



